home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_kernel_source / KERNEL / INFO.C < prev    next >
C/C++ Source or Header  |  1999-09-17  |  734b  |  39 lines

  1. /*
  2.  * linux/kernel/info.c
  3.  *
  4.  * Copyright (C) 1992 Darren Senn
  5.  */
  6.  
  7. /* This implements the sysinfo() system call */
  8.  
  9. #include <linux/mm.h>
  10. #include <linux/unistd.h>
  11. #include <linux/swap.h>
  12. #include <linux/smp_lock.h>
  13.  
  14. #include <asm/uaccess.h>
  15.  
  16. asmlinkage int sys_sysinfo(struct sysinfo *info)
  17. {
  18.     struct sysinfo val;
  19.  
  20.     memset((char *)&val, 0, sizeof(struct sysinfo));
  21.  
  22.     cli();
  23.     val.uptime = jiffies / HZ;
  24.  
  25.     val.loads[0] = avenrun[0] << (SI_LOAD_SHIFT - FSHIFT);
  26.     val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
  27.     val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);
  28.  
  29.     val.procs = nr_tasks-1;
  30.     sti();
  31.  
  32.     si_meminfo(&val);
  33.     si_swapinfo(&val);
  34.  
  35.     if (copy_to_user(info, &val, sizeof(struct sysinfo)))
  36.         return -EFAULT;
  37.     return 0;
  38. }
  39.